#include <signal.h>
#ifndef DRIVEMAP_H
#define DRIVEMAP_H

class driveMap {
private:
    struct packageStruct {
        unsigned char address, cmdCode, param1, param0, data1, data0, status, cs = 0;
    } packageOut, packageIn;

    typedef struct packageStruct package;
    typedef unsigned int pkgline[2];
    typedef unsigned int *pkgMtx[2];

    void synthesisPkg(pkgline pkg);
    static void signal4ForkSearch(int sign);
    int parsingPkg(pkgMtx *pkg);
    int parsing2Pkg(char *buffer);
    int sendPkg(pkgline request);
    int sendPkgWithoutGet(pkgline request);
    int getPkg(pkgline *pkg);
    int execAction();
    int getParametrs();

    unsigned char getControlSum(package *pkg);
    int numOfDevice;

public:

    driveMap(int numDevice);
    ~driveMap();
    char* getAdress();

    int echoTest(int mode = 0);
    void printMsg(char *str);
    void statLexema();
    void findDevice();

};

#endif // DRIVEMAP_H
